import axios from 'axios';


// 携带证书
axios.defaults.withCredentials = true;


//设置超时时间

axios.defaults.timeout = 100000;

export default {

  requestGet(url, params = {}) {
    return new Promise((resolve, reject) => {
      axios.get(url, params).then(res => {
        resolve(res.data)
      }).catch(onerror => {
        reject(onerror);
      })
    })
  },


  requestPut(url, params = {}) {
    return new Promise((resolve, reject) => {
      axios.put(url, params).then(res => {
        resolve(res.data);
      }).catch(error => {
        reject(error);
      })
    })
  },
  requestPost(url, params = {}) {
    return new Promise((resolve, reject) => {
      axios.post(url, params).then(res => {
        resolve(res.data);
      }).catch(error => {
        reject(error);
      })
    })
  }
}
